//
//  ViewController.swift
//  wechatshare
//
//  Created by mengru.tian on 2021/4/22.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    /// 发送Link消息给微信
    @IBAction @objc private func sendLinkContent() {
        let webpageObject = WXWebpageObject()
        webpageObject.webpageUrl = Constant.kLinkURL
        let message = WXMediaMessage()
//        message.title = Constant.kLinkTitle;
        message.description = Constant.kLinkDescription;
        //message.setThumbImage(UIImage(named: "res2.png")!)   //分享后展示图片，没有就显示大大的问号图片。
        message.mediaObject = webpageObject;
        let req = SendMessageToWXReq();
        req.bText = false;
        req.message = message;
        req.scene = Int32(WXSceneSession.rawValue);//WXSceneSession;
        WXApi.send(req) { (result) in}
        
//        let req = SendMessageToWXReq()
//        req.text = "发送旅客的肌肤看来使肌肤快速打开了风急浪大快速反击速度浪费的酸辣粉"
//        req.bText = true
//        req.scene = Int32(WXSceneSession.rawValue)
//        WXApi.send(req) { (result) in}
    }

}

